package proxy;

import lombok.extern.slf4j.Slf4j;

/**
 * @Author: 582895699@qq.com
 * @Desctription: TODO
 * @Date: Created in 2021/12/14 13:58
 */
@Slf4j
public class GamePlayerProxy implements IGamePlayer {

    private IGamePlayer gamePlayer;

    public GamePlayerProxy(IGamePlayer gamePlayer) {
        this.gamePlayer = gamePlayer;
    }

    @Override
    public void login(String name, String pwd) {
        this.before();
        this.gamePlayer.login(name, pwd);
        this.after();
    }

    @Override
    public void killBoss() {
        this.before();
        this.gamePlayer.killBoss();
        this.after();
    }

    @Override
    public void upGrade() {
        this.before();
        this.gamePlayer.upGrade();
        this.after();
    }

    /**
     * 代理的前置方法
     */
    public void before() {
        log.info("前置方法");
    }

    /**
     * 代理的后置方法
     */
    public void after() {
        log.info("后置方法");
    }
}
